<?php

use App\Http\Controllers\AdminController;
use App\Http\Controllers\ExpertController;
use App\Http\Controllers\FrontController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VideoController;
use App\Models\Video;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/login',[UserController::class,'login'])->name('login');
Route::post('/login',[UserController::class,'doLogin']);//处理逻辑
Route::get('/logout',[UserController::class,'logout'])->middleware('auth');

Route::get('/adm',[AdminController::class,'admin'])->middleware('auth');
Route::prefix('adm')->middleware('auth')->group(function (){
    Route::resource('user',UserController::class)->middleware('auth');//后台用户列表页
    Route::resource('expert',ExpertController::class)->middleware('auth');//专家用户列表页
    Route::resource('video',VideoController::class,)->middleware('auth');//后台新增管理员
    Route::post('/video/add-video',[VideoController::class,'store']);
    Route::get('delete',[VideoController::class,'destroy']);
    Route::post('/video/{id}',[VideoController::class,'update']);

    Route::post('/user/add-user',[UserController::class,'store']);//后台新增用户处理逻辑页
    Route::get('/user/edit-user/{id}',[UserController::class,'edit']);//后台更改密码
    Route::post('/user/edit-user/{id}',[UserController::class,'update']);//后台更改密码逻辑处理

    Route::post('/video/add-video',[VideoController::class,'store']);
    Route::get('/video/edit-video/{id}',[VideoController::class,'edit']);
    Route::post('/video/edit-video/{id}',[VideoController::class,'update']);
    Route::post('/expert/upload-doc-thumb', [VideoController::class, 'uploadDocThumb']);

    Route::post('/expert/add-expert',[ExpertController::class,'store']);//后台新增用户处理逻辑页
    Route::get('/expert/edit-expert/{id}',[ExpertController::class,'edit']);//后台更改密码
    Route::post('/expert/edit-expert/{id}',[ExpertController::class,'update']);//后台更改密码逻辑处理
    Route::post('/expert/upload-doc-thumb', [ExpertController::class, 'uploadDocThumb']);

});
Route::get('/',[FrontController::class,'index']);//前台首页
Route::get('/class',[FrontController::class,'class']);//经堂
Route::get('/expert',[FrontController::class,'expert']);//风采
Route::get('/video',[FrontController::class,'video']);//视频
Route::get('/expert/info/{id}',[FrontController::class,'expertShow']);//专家详情
Route::get('/video/info/{id}',[FrontController::class,'videoShow']);//视频详情




